/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
function getTime(){
   
    var obj=document.getElementById("time");
    var myDate=new Date();
    /*
    var month=myDate.getMonth()+1;
    if(month<10)month="0"+month;
    
    var day=myDate.getDate();
    if(day<10)day="0"+day;
    
    var hour=myDate.getHours();
    if(hour<10)hour="0"+hour;
    
    var second=myDate.getSeconds();
    if(second<10)second="0"+second;
    
    var minute=myDate.getMinutes();
    if(minute<10)minute="0"+minute;
    
    //日期字符串
    var date=myDate.getFullYear()+"-"+month+"-"+day+"     "+hour+":"+minute+":"+second;
    */
    obj.innerHTML=myDate.toLocaleString( );
}

window.setInterval(getTime, 1000);



